﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using X.Web;

namespace X.WebSite.Admin.Tag
{
    public partial class Detail : AdminPage
    {
        int _TagId
        {
            get
            {
                int tagId = 0;

                if (!string.IsNullOrEmpty(Request.QueryString["TagId"]))
                    tagId = int.Parse(Request.QueryString["TagId"]);

                return tagId;
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                X.Entity.TagInfo tagInfo = Bll.Product.GetTagInfo(_TagId);

                txtTag.Text = tagInfo.Tag;
                txtOrderNum.Text = tagInfo.OrderNum.ToString();
                chkIsShow.Checked = tagInfo.IsShow;
                chkIsBold.Checked = tagInfo.IsBold;
            }
        }

        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            X.Entity.TagInfo tagInfo = Bll.Product.GetTagInfo(_TagId);

            tagInfo.Tag = txtTag.Text;
            tagInfo.OrderNum = int.Parse(txtOrderNum.Text);
            tagInfo.IsShow = chkIsShow.Checked;
            tagInfo.IsBold = chkIsBold.Checked;

            Bll.Product.UpdateTag(tagInfo);

            Response.Redirect("List.aspx");
        }
    }
}